<template>
  <div v-if="showbill">
    <el-table
      ref="multipleTable"
      :data="waybill"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange"
    >
      <el-table-column prop="waybillNo" label="运单号"> </el-table-column>
      <el-table-column label="日期">
        <template slot-scope="scope">
          <el-date-picker
            v-model="scope.row.signTime"
            type="datetime"
            placeholder="选择日期时间"
            value-format="yyyy-MM-dd HH:mm:ss"
          >
          </el-date-picker>
        </template>
      </el-table-column>
    </el-table>
    <el-row>
      <el-col :span="24">
        <div>
          <el-button type="primary" @click="batchEditSignforNotSamedayWaybill()"
            >保 存</el-button
          >
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { ajax } from "@/store/yg/common/utils";
import axios from "axios";
import * as constant from "@/store/yg/common/constant";

export default {
  data() {
    return {
      waybill: [],
      multipleSelection: [],
      showbill: false
    };
  },

  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },

    initPage() {
      const ids = this.$store.state.edit.ids;
      ajax("batchOpenWaybillEdit", ids).then(
        res => {
          console.log(res.data);
          this.waybill = res.data;
          this.showbill = true;
        },
        error => {
          console.log(error);
        }
      );
    },

    batchEditSignforNotSamedayWaybill() {
      ajax("batchEditSignforNotSamedayWaybill", this.waybill).then(
        res => {
          if (res.code != 200) {
            this.$message.error(res.message);
          } else {
            this.$message.success("保存成功");
          }
        },
        error => {
          console.log(error);
        }
      );
    }
  },
  mounted() {
    this.initPage();
  }
};
</script>
<style scoped></style>

<style lang="scss">
.row-item {
  color: #3f4652;
  line-height: 28px;
  margin-bottom: 14px;
}
</style>
